#include<iostream>
using namespace std;
int main()
{
	int n;
	while (cin >> n)
	{
		if (n == 0) {
			break;
		}
		int ans = 0;
		if (n < 4) {
			ans = n;
			cout << ans << endl;
		}
		else
		{
			int a = 2;
			int b = 3;
			for (int i = 4; i <= n; i++) {
				ans = a + b;
				a = b;
				b = ans;
			}
			cout << ans << endl;
		}
	}
	return 0;
}
1 2 3 4 6 